﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using ERP.Business.DataTypes.Users;

namespace ERP.Business.Services.Users
{
    // NOTE: If you change the interface name "IUsersService" here, you must also update the reference to "IUsersService" in App.config.
    [ServiceContract]
    public interface IUsersService
    {
        /// <summary>
        /// Return user info depending on the username
        /// </summary>
        /// <param name="username">username</param>
        /// <returns>User's info</returns>
        [OperationContract]
        User GetUserByUsername(string username);

        /// <summary>
        /// Return user info depending on the user's id
        /// </summary>
        /// <param name="userId">user's id</param>
        /// <returns>User's info</returns>
        [OperationContract]
        User GetUserByUserID(string userId);

        /// <summary>
        /// Check if username already used
        /// </summary>
        /// <param name="username">username</param>
        /// <returns>result</returns>
        [OperationContract]
        bool CheckUsernameExistance(string username);


        /// <summary>
        /// Create new user
        /// </summary>
        /// <param name="user">New <see cref="User"/></param>
        /// <returns>true if user created</returns>
        [OperationContract(Name = "CreateUserUsingUserObject")]
        bool CreateUser(User user);

        /// <summary>
        /// Create new user
        /// </summary>
        /// <param name="username">username</param>
        /// <param name="password">password</param>
        /// <param name="employeeId">related employee id</param>
        /// <returns>true if user created</returns>
        [OperationContract(Name = "CreateUserUsingUsernamePasswordAndEmployeeId")]
        bool CreateUser(string username, string password, string employeeId);

        /// <summary>
        /// Create new user
        /// </summary>
        /// <param name="userId">user id</param>
        /// <param name="username">username</param>
        /// <param name="password">password</param>
        /// <param name="employeeId">related employee id</param>
        /// <returns>true if user created</returns>
        [OperationContract(Name = "CreateUserUsingUserIdUsernamePasswordAndEmployeeId")]
        bool CreateUser(string userId, string username, string password, string employeeId);

        /// <summary>
        /// Create new user
        /// </summary>
        /// <param name="userId">user id</param>
        /// <param name="username">username</param>
        /// <param name="password">password</param>
        /// <param name="status"><see cref="UserStatus"/></param>
        /// <param name="employeeId">related employee id</param>
        /// <returns>true if user created</returns> 
        [OperationContract(Name = "CreateUserUsingUserIdUsernamePasswordStatusAndEmployeeId")]
        bool CreateUser(string userId, string username, string password, UserStatus status, string employeeId);

        /// <summary>
        /// Update user's info
        /// </summary>
        /// <param name="updatedUserInfo">Updated <see cref="User"/></param>
        /// <returns></returns>
        [OperationContract]
        bool UpdateUserInfo(User updatedUserInfo);

        /// <summary>
        /// Obsolete user
        /// </summary>
        /// <param name="username">username</param>
        /// <returns>true if obsoleted successfully</returns>
        [OperationContract(Name = "DeleteUserUsingUsername")]
        bool DeleteUser(string username);

        /// <summary>
        /// Obsolete user
        /// </summary>
        /// <param name="user"><see cref="User"/></param>
        /// <returns>true if obsoleted successfully</returns>
        [OperationContract(Name = "DeleteUserUsingUserObject")]
        bool DeleteUser(User user);
    }
}
